home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 August: Tool Chest / Dev.CD Aug 95 TC / Dev.CD Aug 95 TC.toast / New System Software Extensions / QuickDraw™ 3D 1.0 / Development / Interfaces / QD3DViewer.h < prev   
Encoding:
C/C++ Source or Header  |  1995-06-02  |  8.5 KB  |  312 lines  |  [TEXT/MPS ]

  1. /******************************************************************************
  2.  **                                                                              **
  3.  **     Module:        QD3DViewer.h                                             **                        
  4.  **                                                                              **
  5.  **                                                                              **
  6.  **     Purpose:     Viewer Controller Interface File.                         **            
  7.  **                                                                              **
  8.  **                                                                              **
  9.  **                                                                              **
  10.  **     Copyright (C) 1994-1995 Apple Computer, Inc.  All rights reserved.     **
  11.  **                                                                              **
  12.  **                                                                              **
  13.  *****************************************************************************/
  14. #ifndef QD3DViewer_h
  15. #define QD3DViewer_h
  16.  
  17. #ifndef QD3D_h
  18. #include "QD3D.h"
  19. #endif  /*  QD3D_h  */
  20.  
  21. #if PRAGMA_ONCE
  22.     #pragma once
  23. #endif
  24.  
  25. #if defined(OS_MACINTOSH) && OS_MACINTOSH
  26.  
  27. #include "QD3DGroup.h"
  28.  
  29. #include <Events.h>
  30. #include <Types.h>
  31. #include <Windows.h>
  32.  
  33. typedef void *TQ3ViewerObject;
  34.  
  35. enum {
  36.     kQ3ViewerShowBadge             = 1<<0,
  37.     kQ3ViewerActive                = 1<<1,
  38.     kQ3ViewerControllerVisible    = 1<<2,
  39.     kQ3ViewerDrawFrame            = 1<<3,
  40.     kQ3ViewerDraggingOff        = 1<<4,
  41.     
  42.     kQ3ViewerButtonCamera        = 1<<5,
  43.     kQ3ViewerButtonTruck        = 1<<6,
  44.     kQ3ViewerButtonOrbit        = 1<<7,
  45.     kQ3ViewerButtonZoom            = 1<<8,
  46.     kQ3ViewerButtonDolly        = 1<<9,
  47.     
  48.  
  49.     kQ3ViewerDefault = (
  50.                 kQ3ViewerActive        | kQ3ViewerControllerVisible | 
  51.                 kQ3ViewerButtonCamera  | kQ3ViewerButtonTruck       | 
  52.                 kQ3ViewerButtonOrbit   | kQ3ViewerButtonDolly )
  53. };
  54.  
  55. enum {
  56.     kQ3ViewerEmpty    = 0,
  57.     kQ3ViewerHasModel = 1<<0
  58. };
  59.  
  60. enum {
  61.     gestaltQD3DViewer            = 'q3vc',
  62.     gestaltQD3DViewerNotPresent    = 0,
  63.     gestaltQD3DViewerAvailable    = 1
  64. };
  65.  
  66. #ifdef __cplusplus
  67. extern "C" {
  68. #endif    /* __cplusplus */
  69.  
  70.  
  71. /******************************************************************************
  72.  **                                                                             **
  73.  **                        Creation and destruction                             **
  74.  **                Note that this is not a QuickDraw 3D object                     **
  75.  **                                                                             **
  76.  *****************************************************************************/
  77.  
  78. TQ3ViewerObject Q3ViewerNew(
  79.     CGrafPtr        port,
  80.     Rect            *rect,
  81.     unsigned long    flags);
  82.     
  83. OSErr Q3ViewerDispose(
  84.     TQ3ViewerObject theViewer);
  85.  
  86.  
  87. /******************************************************************************
  88.  **                                                                             **
  89.  **                    Functions to attach data to a viewer                     **
  90.  **                                                                             **
  91.  *****************************************************************************/
  92.  
  93. OSErr Q3ViewerUseFile(
  94.     TQ3ViewerObject    theViewer,
  95.     long            refNum);
  96.     
  97. OSErr Q3ViewerUseData(
  98.     TQ3ViewerObject    theViewer,
  99.     void            *data,
  100.     long            size);
  101.  
  102.  
  103. /******************************************************************************
  104.  **                                                                             **
  105.  **                Functions to write data out from the Viewer                     **
  106.  **                                                                             **
  107.  *****************************************************************************/
  108.  
  109. OSErr Q3ViewerWriteFile(
  110.     TQ3ViewerObject    theViewer,
  111.     long            refNum);
  112.     
  113. unsigned long Q3ViewerWriteData(
  114.     TQ3ViewerObject    theViewer,
  115.     void            **data);
  116.  
  117.  
  118. /******************************************************************************
  119.  **                                                                             **
  120.  **                Use this function to force the Viewer to re-draw             **
  121.  **                                                                             **
  122.  *****************************************************************************/
  123.  
  124. OSErr Q3ViewerDraw(
  125.     TQ3ViewerObject theViewer);
  126.  
  127.  
  128. /******************************************************************************
  129.  **                                                                             **
  130.  **            Function used by the Viewer to filter and handle events             **
  131.  **                                                                             **
  132.  *****************************************************************************/
  133.  
  134. Boolean Q3ViewerEvent(
  135.     TQ3ViewerObject    theViewer,
  136.     EventRecord        *evt);
  137.  
  138.  
  139. /******************************************************************************
  140.  **                                                                             **
  141.  **        This function returns a PICT of the contents of the                  **
  142.  **        Viewer's window.  The application should dispose the PICT.             **
  143.  **                                                                             **
  144.  *****************************************************************************/
  145.  
  146. PicHandle Q3ViewerGetPict(
  147.     TQ3ViewerObject theViewer);
  148.  
  149.  
  150. /******************************************************************************
  151.  **                                                                             **
  152.  **                        Calls for dealing with Buttons                         **
  153.  **                                                                             **
  154.  *****************************************************************************/
  155.  
  156. OSErr Q3ViewerGetButtonRect(
  157.     TQ3ViewerObject    theViewer,
  158.     unsigned long    button,
  159.     Rect            *rect);
  160.  
  161. unsigned long Q3ViewerGetCurrentButton(
  162.     TQ3ViewerObject    theViewer);
  163.     
  164. OSErr Q3ViewerSetCurrentButton(
  165.     TQ3ViewerObject    theViewer,
  166.     unsigned long    button);
  167.  
  168.  
  169. /******************************************************************************
  170.  **                                                                             **
  171.  **        Functions to set/get the group to be displayed by the Viewer.         **
  172.  **                                                                             **
  173.  *****************************************************************************/
  174.  
  175. OSErr Q3ViewerUseGroup(
  176.     TQ3ViewerObject    theViewer,
  177.     TQ3GroupObject    group);
  178.     
  179. TQ3GroupObject Q3ViewerGetGroup(
  180.     TQ3ViewerObject    theViewer);
  181.  
  182.  
  183. /******************************************************************************
  184.  **                                                                             **
  185.  **            Functions to set/get the color used to clear the window             **
  186.  **                                                                             **
  187.  *****************************************************************************/
  188.  
  189. OSErr Q3ViewerSetBackgroundColor(
  190.     TQ3ViewerObject    theViewer,
  191.     TQ3ColorARGB    *color);
  192.     
  193. OSErr Q3ViewerGetBackgroundColor(
  194.     TQ3ViewerObject    theViewer,
  195.     TQ3ColorARGB    *color);
  196.  
  197.  
  198. /******************************************************************************
  199.  **                                                                             **
  200.  **        Getting/Setting a Viewer's View object.  Disposal is needed.         **
  201.  **                                                                             **
  202.  *****************************************************************************/
  203.  
  204. TQ3ViewObject Q3ViewerGetView(
  205.     TQ3ViewerObject    theViewer);
  206.  
  207. OSErr Q3ViewerRestoreView(
  208.     TQ3ViewerObject    theViewer);
  209.  
  210.  
  211. /******************************************************************************
  212.  **                                                                             **
  213.  **                Calls for setting/getting viewer flags                         **
  214.  **                                                                             **
  215.  *****************************************************************************/
  216.  
  217. OSErr Q3ViewerSetFlags(
  218.     TQ3ViewerObject    theViewer,
  219.     unsigned long    flags);
  220.     
  221. unsigned long Q3ViewerGetFlags(
  222.     TQ3ViewerObject    theViewer);
  223.  
  224.  
  225. /******************************************************************************
  226.  **                                                                             **
  227.  **        Calls related to bounds/dimensions.  Bounds is the size of              **
  228.  **        the window.  Dimensions can either be the Rect from the ViewHints     **
  229.  **        or the current dimensions of the window (if you do a Set).             **
  230.  **                                                                             **
  231.  *****************************************************************************/
  232.  
  233. OSErr Q3ViewerSetBounds(
  234.     TQ3ViewerObject    theViewer,
  235.     Rect            *bounds);
  236.     
  237. OSErr Q3ViewerGetBounds(
  238.     TQ3ViewerObject    theViewer,
  239.     Rect            *bounds);
  240.  
  241. OSErr Q3ViewerGetDimension(
  242.     TQ3ViewerObject    theViewer,
  243.     unsigned long    *width,
  244.     unsigned long    *height);
  245.  
  246.  
  247. /******************************************************************************
  248.  **                                                                             **
  249.  **                            Port related calls                                 **
  250.  **                                                                             **
  251.  *****************************************************************************/
  252.  
  253. OSErr Q3ViewerSetPort(
  254.     TQ3ViewerObject    theViewer,
  255.     CGrafPtr        port);
  256.     
  257. CGrafPtr Q3ViewerGetPort(
  258.     TQ3ViewerObject    theViewer);
  259.  
  260.  
  261. /******************************************************************************
  262.  **                                                                             **
  263.  **        Adjust Cursor should be called from idle loop to allow the Viewer     **
  264.  **        to change the cursor according to the cursor position/object under     **
  265.  **        the cursor.                                                             **
  266.  **                                                                             **
  267.  *****************************************************************************/
  268.  
  269. Boolean Q3ViewerAdjustCursor(
  270.     TQ3ViewerObject    theViewer,
  271.     Point            *pt);
  272.  
  273.  
  274. /******************************************************************************
  275.  **                                                                             **
  276.  **        Returns the state of the viewer.  See the constant defined at the     **
  277.  **        top of this file.                                                     **
  278.  **                                                                             **
  279.  *****************************************************************************/
  280.  
  281. unsigned long Q3ViewerGetState(
  282.     TQ3ViewerObject    theViewer);
  283.  
  284.  
  285. /******************************************************************************
  286.  **                                                                             **
  287.  **                            Clipboard utilities                                 **
  288.  **                                                                             **
  289.  *****************************************************************************/
  290.  
  291. OSErr Q3ViewerClear(
  292.     TQ3ViewerObject    theViewer);
  293.     
  294. OSErr Q3ViewerCut(
  295.     TQ3ViewerObject    theViewer);
  296.     
  297. OSErr Q3ViewerCopy(
  298.     TQ3ViewerObject    theViewer);
  299.     
  300. OSErr Q3ViewerPaste(
  301.     TQ3ViewerObject    theViewer);
  302.  
  303.  
  304. #ifdef __cplusplus
  305. }
  306. #endif    /* __cplusplus */
  307.  
  308. #endif     /* OS_MACINTOSH */
  309.  
  310. #endif    /* QD3DViewer_h */
  311.  
  312.